global n dimx R2
global xbar X sig2 SigmaB1inv SigmaB0inv 
global Vstar priorvar Cbar1 Cbar0 Vtilde1 Vtilde0 Sigma1 Sigma0
global XNI xbarNI






%%%%%%%%%%%%%covariance kernel parameters%%%%%%%%%%%%
%covariance matrix
C=zeros(n);
for i=1:n
    for j=1:n
        C(i,j)=exp(-(X(i,:) - X(j,:))* (X(i,:) - X(j,:))'/2);
    end
end

Cbar=sum(C)/n;
Vtilde=C;


%choosing sig2 based on R2
%sig2=((1-R2)/R2) * (trace(C) - mean(Cbar))/n;

%homoskedastic residual variances
Sigma=sig2 * ones(n,1);

%assigning all the required global parameters
Cbar1=Cbar;
Cbar0=Cbar;
Vtilde1=Vtilde;
Vtilde0=Vtilde;
Sigma1=Sigma;
Sigma0=Sigma;
priorvar=2*sum(Cbar)/n;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%linear model parameters %%%%%%%%%%%%%%%
SigmaB1inv=0.001*eye(dimx+1);
SigmaB0inv=0.001*eye(dimx+1);
xbar = mean(X);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%% X over which NI prior is noninformative %%%%%%%%%%%%%%%
XNI=ones(n,1);
xbarNI=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%